import request from '@/router/axios';

/**
 *待检单
 */
export const getList = (current, size, params) => {
    return request({
        url: '/api/mes-product/qms-inspection-document/page?statusStr=2,3,5,6',
        method: 'get',
        params: {
            ...params,
            current,
            size
        }
    });
};

export const getDetail = (id) => {
    return request({
        url: '/api/mes-product/qms-inspection-document/detail-by-id',
        method: 'get',
        params: {
            id
        }
    });
};

export const add = (data) => {
    return request({
        url: '/api/mes-product/qms-inspection-document/submit',
        method: 'post',
        data: data
    });
};

export const getWorkOrderDetail = (workOrderNo, documentType) => {
    return request({
        url: '/api/mes-product/qms-inspection-document/search-work-order',
        method: 'get',
        params: {
            workOrderNo,
            documentType
        }
    });
};

export const getLineList = () => {
    return request({
        url: '/api/mes-product/productionline/list-by-valid',
        method: 'get'
    });
};

export const handle = (data) => {
    return request({
        url: '/api/mes-product/qms-inspection-document/submit-result',
        method: 'post',
        data: data
    });
};

export const getMainTypeList = () => {
    return request({
        url: '/api/mes-product/mro/dict/list?dictType=CAUSE',
        method: 'get'
    });
};

export const getSubTypeList = (id) => {
    return request({
        url: '/api/mes-product/mro/dict/detail',
        method: 'get',
        params: {
            id
        }
    });
};

export const revoke = (data) => {
    return request({
        url: '/api/mes-product/qms-inspection-document/document-revoke',
        method: 'post',
        data
    });
};

// 二次检接口
export const secondTimeInspection = (id) => {
    return request({
        url: '/api/mes-product/qms-inspection-document/second-time-inspection',
        method: 'get',
        params: {
            id
        }
    });
};

// 检验单号打印
export const printDocumentNo = (data) => {
    return request({
        url: '/api/mes-product/qms-inspection-document/print-document-no',
        method: 'post',
        data: data
    });
};
